package MovieData;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Movie implements Serializable {
    private String name;
    private int duration;
    private int price;
    private String director;
    private String LeadingRole;
    private Date ReleaseData;
    /*
    * 序列化的电影类
    * name存储电影名
    * duration存储电影时长
    * price存储电影票价格
    * director存储导演信息
    * leadingRole存储主演信息
    * releaseDate存储上映时间
    * */
    public Movie() {
    }

    public Movie(String name, int duration, int price, String director, String leadingRole, Date releaseData) {
        this.name = name;
        this.duration = duration;
        this.price = price;
        this.director = director;
        LeadingRole = leadingRole;
        ReleaseData = releaseData;
    }

    @Override
    public String toString() {
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
        return "电影名:"+getName()+"\n电影时长:"+getDuration()+"\n电影票价格:"+getPrice()+"\n导演姓名:"
                +getDirector()+"\n主演姓名:"+getLeadingRole()+"\n上映时间:"+sdf.format(getReleaseData())+"\n******************************************************";
    }
    /*
    * 改写toString方法，输出的时候好看一点*/

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getDuration() {
        return duration;
    }

    public void setDuration(int duration) {
        this.duration = duration;
    }

    public String getDirector() {
        return director;
    }

    public void setDirector(String director) {
        this.director = director;
    }

    public String getLeadingRole() {
        return LeadingRole;
    }

    public void setLeadingRole(String leadingRole) {
        LeadingRole = leadingRole;
    }

    public Date getReleaseData() {
        return ReleaseData;
    }

    public void setReleaseData(Date releaseData) {
        ReleaseData = releaseData;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }
    /*
    * 普通的Get Set方法-。-*/
}
